import flask
from flask import Blueprint
import db

page_front = Blueprint('page_front', __name__)


@page_front.route('/')
def root():
    """
    front page
    :return: null
    """
    return flask.render_template('./static/templates/index.html')


@page_front.route('/recommend')
def recommend():
    """
    get at most 30 goods items and packaged them into json
    :return:
        json instance to front end
    """
    goods_info = db.get_some_goods(30)
    return flask.jsonify(goods_info)